//
//  HMTempViewController.m
//  swift-新浪微博OC版-8-29
//
//  Created by 赵玉忠 on 16/8/30.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "HMTempViewController.h"

@interface HMTempViewController ()

@end

@implementation HMTempViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = [NSString stringWithFormat:@"第%lu个控制器",self.navigationController.childViewControllers.count];
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem HMBarButtonItem:@"navigationbar_back_withtext" andWithTitle:@"返回" andWithTarget:self andWithAction:@selector(back)];
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem HMBarButtonItem:nil andWithTitle:@"PUSH" andWithTarget:self andWithAction:@selector(push)];
}

-(void)back{
    if (self.navigationController.childViewControllers.count != 1) {
        [self.navigationController popViewControllerAnimated:YES];
    }else{
        [self dismissViewControllerAnimated:YES completion:nil];
    }
}
-(void)push{
    HMTempViewController *vc = [HMTempViewController new];
    [self.navigationController pushViewController:vc animated:YES];
}


@end
